﻿<!-- announcementAdd -->
<?
global $DB, $sess, $sPOST, $sGET;
include_once "settings.inc.php";

if(isset($_POST))
{
	$sql = "SELECT * FROM " . _MODULE_NAME . "Category WHERE id=".$sGET['id'];
	$row = $DB->fetchArray($sql);
	if(!is_array($row[0]))
		git("?"._MODULE_NAME.".listCategory");
}
?>
<style>
	label		{	font-family:Tahoma; font-size:12px; font-weight:bold; text-align:right;	}
	textarea 	{	position:relative; min-height:250px; background:#fff;	}
	.etiket		{	width:150px; min-height:30px; line-height:30px;	}
	.pictureDelete {	cursor: pointer;}
	#pictureContainer > a > img {	border:3px solid #555;}
</style>

<h2>ÜRÜN KATEGORİ GÜNCELLE</h2>
<form method="post" action="?<?=_MODULE_NAME?>.editCategoryProcess" method="POST" enctype="multipart/form-data" >
	<fieldset>
		<!-- <legend>Duyuru Ekleme</legend> -->
		<input type="hidden" name="id" id="id" value="<?=$row[0]['id']?>" />
		<table cellpadding="0" cellspacing="3" border="0" style="width:100%;">
			<tr>
				<td class="right etiket"><label for="category_namex">Üst Kategori Adı : </label></td>
				<td>
					<select name="parent" id="parent">
						<option value="0">Ana Kategori</option>
						<?
							function subCategoryList($parentId, $symbol, $selected)
							{
								global $DB;
								$sym.=$symbol;
								$sql="SELECT * FROM productsCategory WHERE parent=$parentId ORDER BY row ASC";
								$categorys = $DB->fetchArray($sql);
								if(is_array($categorys[0]))
								{
									foreach($categorys as $cat)
									{
										if($selected == $cat['id'])
											echo '<option value="'.$cat['id'].'" selected="selected">'.$sym.$cat['category_name'].'</option>';
										else
											echo '<option value="'.$cat['id'].'">'.$sym.$cat['category_name'].'</option>';
										subCategoryList($cat['id'],$sym." &rarr; ",$selected);
									}
								}
							}
							subCategoryList(0," ", $row[0]['parent']);
						?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="right etiket"><label for="category_namex">Kategori Adı: </label></td>
				<td><input class="mf" name="category_name" id="category_namex" type="text" value="<?=$row[0]['category_name']?>" /></td>
			</tr>
			<tr>
				<td class="etiket">&nbsp;</td>
				<td class="left">
					<input class="button" type="submit" value="Güncelle" />
					<input class="button geri" type="button" value="Geri" />
				</td>
			</tr>
		</table>
	</fieldset>
</form>
<!-- /announcementAdd -->		